package qreasymarket.movil;

import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class AyudaActivity extends Activity {

	public Button llamadaop1, llamadaop2, llamadaop3;
	public Intent llamadaInt;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.llamada_operad);

		llamadaop1 = (Button) findViewById(R.id.btnllamada1);
		llamadaop2 = (Button) findViewById(R.id.btnllamada2);
		llamadaop3 = (Button) findViewById(R.id.btnllamada3);

		this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

		llamadaop1.setOnClickListener(new OnClickListener() {

			// @Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				call();
			}
		});

		llamadaop2.setOnClickListener(new OnClickListener() {

			// @Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				call2();
			}
		});

		llamadaop3.setOnClickListener(new OnClickListener() {

			// @Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				call3();
			}
		});

	}

	private void call() {
		try {
			llamadaInt = new Intent(Intent.ACTION_CALL);
			llamadaInt.setData(Uri.parse("tel:959107628"));
			startActivity(llamadaInt);
		} catch (ActivityNotFoundException activityException) {
			Log.e("dialing-example", "Call failed", activityException);
		}
	}

	private void call2() {
		try {
			llamadaInt = new Intent(Intent.ACTION_CALL);
			llamadaInt.setData(Uri.parse("tel:959216866"));
			startActivity(llamadaInt);
		} catch (ActivityNotFoundException activityException) {
			Log.e("dialing-example", "Call failed", activityException);
		}
	}

	private void call3() {
		try {
			llamadaInt = new Intent(Intent.ACTION_CALL);
			llamadaInt.setData(Uri.parse("tel:123456780"));
			startActivity(llamadaInt);
		} catch (ActivityNotFoundException activityException) {
			Log.e("dialing-example", "Call failed", activityException);
		}
	}

	// }

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		MenuInflater inflater = getMenuInflater();
		inflater.inflate(R.menu.menuprincipal, menu);
		return true;
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		if (item.getItemId() == R.id.PromocionService) {
			startActivity(new Intent(AyudaActivity.this, CarruselActivity.class));
			return (true);
		}

		return (super.onOptionsItemSelected(item));
	}

}
